<template>
<div class="layerRtb layerRtb-threecolumn layerRtb-right">
    <three-title :title="{name:'材料详情'}" :close="false">
        <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFourShow()"></span>
    </three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "137" >
        <div class="analyItem"  v-for="(item, index) in shopDetailDate" :key="index">
            <p class="analyItemTit tx-center">产品{{index + 1}}</p>
            <div class="analyItemCon">
                <div class="flex">
                    <div class="col-md-3">
                        <img :src="item.matPhoto" :alt="item.matName" class="marImg">
                    </div>
                    <div class="col-md-9">
                        <p>
                            <span class="fz16 tx-fb  pr8">{{item.matName}}</span>
                            <span>{{item.brandName}}</span>
                        </p>
                        <p>
                            <span class="cLightGray pr8">描述</span>
                            <span>{{item.proDescribe === '' ? '暂无描述' : ''}}</span>
                        </p>
                        <p>
                            <span class="cLightGray pr8">规格</span>
                            <span class="spanStyle">{{item.matSpec}}</span>
                        </p>
                        <p>
                            <span class="cLightGray pr8">型号</span>
                            <span class="mr5" v-for="(valueitem, index) in item.valueList" :key="index">{{valueitem.paraValue}}</span>
                        </p>
                        <p>
                            <span class="cLightGray pr8">需求量</span>
                            <span>{{item.totalCount}}</span>
                        </p>
                    </div>
                    <span class="rigthShow">设计师/客户 <span class="cRed">{{item.isConfirm ? '已确认' : '未确认'}} </span>使用此材料</span>
                </div>
            </div>
        </div>
    </div>
    <div class="layerRtb-footer">
        <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
                <p>
                    <span class="cLightGray pr8">店铺</span>
                    <span>{{name}}</span>
                </p>
                <p>
                    <span class="cLightGray pr8">产品</span>
                    <span>{{shopDetailDate.length}}</span>
                </p>
            </div>
        </div>
    </div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { GetMaterialItemsByRwdIDShopID } from '../../../Resources/Api/index'
export default {
    props: ['shopId', 'name'],
    data () {
        return {
            loading: false,
            shopDetailDate: [] // 店铺清单详情
        }
    },
    computed: {
        ...mapGetters(['leftInfo', 'userInfo'])
    },
    created () {
        this.load()
    },
    methods: {
        load () {
            this.loading = true
            GetMaterialItemsByRwdIDShopID({
                rwdID: this.leftInfo.orderno,
                shopId: this.shopId
            }).then((result) => {
                if (result.data.statusCode === 1) {
                    this.shopDetailDate = result.data.body
                }
                this.loading = false
            }).catch((err) => {
                console.log(err)
            })
        }
    }
}
</script>
<style lang="scss" scoped>
    .flex {
        display: flex;
        justify-content: space-between;
    }
    .marImg {
        width: 80%;
        height: 100px;
    }
    .spanStyle {
        border: 1px solid #999;
        border-radius: 3px;
        padding: 1px 5px;
        margin: 0 5px 0 0;
        line-height: 14px;
        cursor: pointer;
    }
    .rigthShow {
        position: absolute;
        top: 50%;
        right: 5px;
        border: 1px solid #999;
        border-radius: 3px;
        padding: 1px 5px;
        margin: 0;
        font-size: 12px;
    }
</style>
